//
//  HMTabBarController.m
//  网易彩票01
//
//  Created by Macx on 16/2/19.
//  Copyright © 2016年 Macx. All rights reserved.
//

#import "HMTabBarController.h"
#import "HMTabBar.h"
@interface HMTabBarController ()<HMTabBarDelegate>

@end

@implementation HMTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self.tabBar removeFromSuperview];
    //添加自定义的tabBar
    HMTabBar *customTabBar=[[HMTabBar alloc]init];
    NSInteger count=self.childViewControllers.count;//用viewController还是ChildViewController；
    for (NSInteger i=0; i<count; i++) {
        NSString *normalImg=[NSString stringWithFormat:@"TabBar%ld",i+1];
        NSString *selectedImg=[NSString stringWithFormat:@"TabBar%ldSel",i+1];
        [customTabBar addTabBarBtnWithNormalImg:normalImg andSelectedImg:selectedImg];
    }
    customTabBar.delegate=self;
    customTabBar.frame=self.tabBar.frame;
    [self.view addSubview:customTabBar];
}

#pragma mark HMTabBarDelegate 代理方法的实现；
-(void)tabBar:(HMTabBar *)tabBar didSelectBtn:(UIButton *)btn{
  
    self.selectedViewController=self.viewControllers[btn.tag];
}

@end
